package com.taotao.wechat.util;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;

public class WebServiceUtil {
    public static String getData(String openId) {
        String result = "";
        try {
            String endpoint = "http://123.103.63.75/QueryPrize.asmx";
            //直接引用远程的wsdl文件
            Service service = new Service();
            Call call = (Call) service.createCall();
            call.setTargetEndpointAddress(new java.net.URL(endpoint));
            call.setOperationName(new QName("http://tempuri.org/", "GetPrize"));
            call.addParameter("wxNum", XMLType.XSD_STRING, ParameterMode.IN);
            call.setReturnType(XMLType.XSD_STRING);

            Object[] param = {openId};
            result = (String)call.invoke(param);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }

    public static void main(String[] args) {
        System.out.println(getData("oANkGuDt2iccy3AVpHRQQKeF0jpk"));
    }
}
